<!DOCTYPE HTML>
<html lang="zh-CN">

<head>
    <!--Setting-->
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta http-equiv="Cache-Control" content="no-siteapp">
    <meta http-equiv="Cache-Control" content="no-transform">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta name="apple-mobile-web-app-capable" content="涛哥的博客">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no,email=no,adress=no">
    <meta name="browsermode" content="application">
    <meta name="screen-orientation" content="portrait">
    <meta name="theme-version" content="1.2.3">
    <meta name="root" content="/">
    <link rel="dns-prefetch" href="https://jaredtao.github.io">
    <!--SEO-->

<meta name="keywords" content="Qt,持续集成(CI)" />


<meta name="description" content="
前言
简介
代码仓库
效果预览
使用方式
原理
Actions官方文档
Actions的默认环境
Actions语法
Actions模板
Qt项目的编译流程
Qt相关的Actions模板
in..." />


<meta name="robots" content="all" />
<meta name="google" content="all" />
<meta name="googlebot" content="all" />
<meta name="verify" content="all" />
    <!--Title-->

<title>
    
    玩转Qt(10)-github-Actions自动化编译 |
    
    涛哥的博客
</title>

<link rel="alternate" href="/atom.xml" title="涛哥的博客" type="application/atom+xml">


<link rel="icon" href="/favicon.ico">

    


<link rel="stylesheet" href="/css/bootstrap.min.css?rev=3.3.7.css">
<link rel="stylesheet" href="/css/font-awesome.min.css?rev=4.7.0.css">
<link rel="stylesheet" href="/css/style.css?rev=@@hash.css">

    
<div class="hide">
    <script type="text/javascript">
    var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
    document.write(unescape("%3Cspan class='cnzz_stat_icon_1263868967 hide' %3E%3Cscript%20src%3D%22https%3A%2F%2Fs95.cnzz.com%2Fz_stat.php%3Fweb_id%3D1272564536%22%3E%3C%2Fscript%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s19.cnzz.com/z_stat.php%3Fid%3D1263868967%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));
    </script>
</div>




    

<script>
(function() {
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
    } else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>

<meta name="generator" content="Hexo 4.2.1"></head>
<!--[if lte IE 8]>
<style>
    html{ font-size: 1em }
</style>
<![endif]-->
<!--[if lte IE 9]>
<div style="ie">你使用的浏览器版本过低，为了你更好的阅读体验，请更新浏览器的版本或者使用其他现代浏览器，比如Chrome、Firefox、Safari等。</div>
<![endif]-->
<body>
    <header class="main-header"  style="background-image:url(
    http://snippet.shenliyang.com/img/banner.jpg)"
     >
    <div class="main-header-box">
        <a class="header-avatar" href="/" title='JaredTao'>
            <img src="/img/avatar.jpg" alt="logo头像" class="img-responsive center-block">
        </a>
        <div class="branding">
            <!--<h2 class="text-hide">Snippet主题,从未如此简单有趣</h2>-->
            
            <h2>
                单枪匹马亦对饮，历经磨难记初心
            </h2>
            
        </div>
    </div>
</header>
    <nav class="main-navigation">
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                <div class="navbar-header"><span class="nav-toggle-button collapsed pull-right" data-toggle="collapse" data-target="#main-menu" id="mnav">
                        <span class="sr-only"></span>
                        <i class="fa fa-bars"></i>
                    </span>
                    <a class="navbar-brand" href="https://jaredtao.github.io">
                        涛哥的博客</a>
                </div>
                <div class="collapse navbar-collapse" id="main-menu">
                    <ul class="menu">
                        
                        <li role="presentation" class="text-center">
                            <a href="/"><i class="fa "></i>
                                首页</a>
                        </li>
                        
                        <li role="presentation" class="text-center">
                            <a href="/categories/玩转Qt/"><i class="fa "></i>
                                玩转Qt</a>
                        </li>
                        
                        <li role="presentation" class="text-center">
                            <a href="/categories/玩转Qml/"><i class="fa "></i>
                                玩转Qml</a>
                        </li>
                        
                        <li role="presentation" class="text-center">
                            <a href="/categories/玩转QtQuick/"><i class="fa "></i>
                                玩转QtQuick</a>
                        </li>
                        
                        <li role="presentation" class="text-center">
                            <a href="/categories/涛哥的博客/"><i class="fa "></i>
                                涛哥的博客</a>
                        </li>
                        
                        <li role="presentation" class="text-center">
                            <a href="/archives/"><i class="fa "></i>
                                时间轴</a>
                        </li>
                        
                    </ul>
                </div>
            </div>
        </div>
    </div>
</nav>
    <section class="content-wrap">
        <div class="container">
            <div class="row">
                <main class="col-md-8 main-content m-post">
                    <p id="process"></p>
<article class="post">
    <div class="post-head">
        <h1 id="玩转Qt(10)-github-Actions自动化编译">
            
            玩转Qt(10)-github-Actions自动化编译
            
        </h1>
        <div class="post-meta">
    
    <span class="categories-meta fa-wrap">
        <i class="fa fa-folder-open-o"></i>
        <a class="category-link" href="/categories/%E7%8E%A9%E8%BD%ACQt/">玩转Qt</a>
    </span>
    
    
    <span class="fa-wrap">
        <i class="fa fa-tags"></i>
        <span class="tags-meta">
            
            <a class="tag-link" href="/tags/Qt/" rel="tag">Qt</a> <a class="tag-link" href="/tags/%E6%8C%81%E7%BB%AD%E9%9B%86%E6%88%90-CI/" rel="tag">持续集成(CI)</a>
            
        </span>
    </span>
    
    
    
    <span class="fa-wrap">
        <i class="fa fa-clock-o"></i>
        <span class="date-meta">
            2019/11/19</span>
    </span>
    
    <span class="fa-wrap">
        <i class="fa fa-eye"></i>
        <span id="busuanzi_value_page_pv"></span>
    </span>
    
    
</div>
        
        
        <p class="fa fa-exclamation-triangle warning">
            本文于<strong>
                868</strong>
            天之前发表，文中内容可能已经过时。
        </p>
        
    </div>
    
<div id="post-gallery">
    
    <img src="/images/QtActions/1.png" alt="gallery-img" class="gallery">
    
</div>

    <div class="post-body post-content">
        <ul>
<li><a href="#前言">前言</a></li>
<li><a href="#简介">简介</a></li>
<li><a href="#代码仓库">代码仓库</a></li>
<li><a href="#效果预览">效果预览</a></li>
<li><a href="#使用方式">使用方式</a></li>
<li><a href="#原理">原理</a><ul>
<li><a href="#actions官方文档">Actions官方文档</a></li>
<li><a href="#actions的默认环境">Actions的默认环境</a></li>
<li><a href="#actions语法">Actions语法</a></li>
<li><a href="#actions模板">Actions模板</a></li>
<li><a href="#qt项目的编译流程">Qt项目的编译流程</a></li>
<li><a href="#qt相关的actions模板">Qt相关的Actions模板</a><ul>
<li><a href="#install-qt-action">install-qt-action</a></li>
<li><a href="#action-setup-qt">action-setup-qt</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#扩展">扩展</a><ul>
<li><a href="#windows平台">Windows平台</a><ul>
<li><a href="#默认mingw不能用">默认mingw不能用</a></li>
<li><a href="#windows平台指定shell">Windows平台指定shell</a></li>
</ul>
</li>
<li><a href="#ubuntu平台">Ubuntu平台</a></li>
<li><a href="#macos平台">MacOS平台</a></li>
<li><a href="#android平台">Android平台</a></li>
<li><a href="#ios平台">IOS平台</a></li>
</ul>
</li>
</ul>
<h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>几个月前写过两篇持续集成的教程，当时使用的是travis和appveyor这两个第三方网址提供的服务。</p>
<p>由于配置比较复杂，劝退了很多同学……</p>
<p>2019年8月份，github正式上线了Actions功能，提供了十分强大的CI(持续集成)/CD(持续部署)服务，</p>
<p>使用非常简单、方便，再加上github的Marketplace(github的应用商店)有各路大神开源的Actions模板, 完全可以抛弃那些落后的第三方服务了。</p>
<p>注：Actions也能在私有仓库上用(微软良心)。</p>
<h2 id="简介"><a href="#简介" class="headerlink" title="简介"></a>简介</h2><p>这回涛哥将给大家提供一个简易的Qt项目的Action模板，让每一个有追求的Qter，都能轻松地用上强大的CI/CD功能。</p>
<p>(本文先说自动化编译，自动化发布下次说。)</p>
<h2 id="代码仓库"><a href="#代码仓库" class="headerlink" title="代码仓库"></a>代码仓库</h2><p>我创建了一个新的代码仓库，地址在这:</p>
<p><a href="https://github.com/jaredtao/HelloActions-Qt" target="_blank" rel="noopener">https://github.com/jaredtao/HelloActions-Qt</a></p>
<h2 id="效果预览"><a href="#效果预览" class="headerlink" title="效果预览"></a>效果预览</h2><p>先来看看效果吧</p>
<p>这是github的Actions页面</p>
<p><img src="/images/QtActions/1.png" alt=""></p>
<p>图中可以看到，最后一次提交的代码，在Windows、Ubuntu、MacOS、Android、IOS五个平台都编译通过了(通过显示绿色的对勾✔，未通过显示红色的叉❌)。</p>
<p>涛哥是个徽章爱好者，把这些徽章都链接进了README文件中。别人在预览代码仓库的时候，很容易就能看到仓库的编译状态。<br><img src="/images/QtActions/2.png" alt=""></p>
<p>当然，在commit页面，还可以详细查看每一次commit的代码，是否都编译通过<br><img src="/images/QtActions/3.png" alt=""></p>
<h2 id="使用方式"><a href="#使用方式" class="headerlink" title="使用方式"></a>使用方式</h2><p>(这里假设各位读者会使用基本的git、github操作，不会的请去搜索相关教程)</p>
<ol>
<li>下载涛哥的仓库HelloActions-Qt</li>
</ol>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone https://github.com/jaredtao/HelloActions-Qt</span><br></pre></td></tr></table></figure>

<ol start="2">
<li><p>拷贝文件夹’.github’到你的代码仓库根目录</p>
</li>
<li><p>在你的仓库中commit并添加.github文件夹中的文件</p>
</li>
<li><p>push你的仓库到github</p>
</li>
</ol>
<p>push完就可以了，到你的github相应仓库页面-Actions子页面查看状态吧。</p>
<p>没错，复制、粘贴，就这么简单。</p>
<p>.github/workflows文件夹中包括写好的5个模板：</p>
<p><img src="/images/QtActions/4.png" alt=""></p>
<p>你也可以根据你的需要，只选择你需要的。</p>
<h2 id="原理"><a href="#原理" class="headerlink" title="原理"></a>原理</h2><p>授人以鱼，不如授人以渔</p>
<p>这里再来介绍一些基本的原理。</p>
<h3 id="Actions官方文档"><a href="#Actions官方文档" class="headerlink" title="Actions官方文档"></a>Actions官方文档</h3><p>可以参考 <a href="https://help.github.com/cn/actions/automating-your-workflow-with-github-actions" target="_blank" rel="noopener">github Actions官方文档</a></p>
<p>中文文档目前翻译不全面，建议优先看英文的。</p>
<h3 id="Actions的默认环境"><a href="#Actions的默认环境" class="headerlink" title="Actions的默认环境"></a>Actions的默认环境</h3><p>github-Actions 主要提供了windows server 2019、macos 10.15、ubuntu 18.04三个平台的docker环境，</p>
<p>并预装了大量开发者常用的软件,比如Java SDK、Android SDK、VisualStudio、python、golang、nodejs等，</p>
<p>可以在文档<a href="https://help.github.com/cn/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners" target="_blank" rel="noopener">github Actions默认环境及预装软件</a> 中看到详细的信息。</p>
<h3 id="Actions语法"><a href="#Actions语法" class="headerlink" title="Actions语法"></a>Actions语法</h3><p>github-Actions和大部分docker环境一样，使用yaml/yml格式的配置文件。</p>
<p>同时github-Actions还提供了一些便利的功能、函数，可以参考</p>
<p><a href="https://help.github.com/cn/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions" target="_blank" rel="noopener">github Actions配置文件语法</a></p>
<p>更多细节请大家参考文档，这里就不赘述了。</p>
<h3 id="Actions模板"><a href="#Actions模板" class="headerlink" title="Actions模板"></a>Actions模板</h3><p>每个github仓库，都有一个Actions页面，在这里可以创建、管理Actions</p>
<p><img src="/images/QtActions/5.png" alt=""></p>
<p>一般使用nodejs、python、golang等环境的项目，github提供了现成的Actions模板，可以</p>
<p>直接在Actions创建页面或者Marketplace(github的应用商店)进行搜索、引用。</p>
<p><img src="/images/QtActions/6.png" alt=""></p>
<p>有闲暇的开发者，也可以开发自己的Actions并提交到github商店，甚至可以赚点零花钱哦。</p>
<p>(Actions开发使用TypeScript)</p>
<h3 id="Qt项目的编译流程"><a href="#Qt项目的编译流程" class="headerlink" title="Qt项目的编译流程"></a>Qt项目的编译流程</h3><p>简单总结一下Qt项目的编译流程</p>
<ol>
<li><p>安装Qt环境</p>
<p>这一步用下文的Action模板：install-qt-action</p>
</li>
<li><p>获取项目代码</p>
<p>这一步用Actions官方核心模板：actions/checkout@v1</p>
</li>
<li><p>执行qmake、make</p>
<p> 这一步用自定义脚本，可以换成qbs、cmake、gn、ninja等构建工具</p>
</li>
<li><p>执行test</p>
<p> 这一步可以引入单元测试、自动化UI测试等。以后再说。</p>
</li>
<li><p>执行deployment</p>
<p> 等我下一篇文章</p>
</li>
</ol>
<h3 id="Qt相关的Actions模板"><a href="#Qt相关的Actions模板" class="headerlink" title="Qt相关的Actions模板"></a>Qt相关的Actions模板</h3><p><img src="/images/QtActions/7.png" alt=""></p>
<h4 id="install-qt-action"><a href="#install-qt-action" class="headerlink" title="install-qt-action"></a>install-qt-action</h4><p>Qt项目暂时没有公开、完整的Actions模板,不过有一个安装Qt的Actions，解决了在不同平台安装不同版本Qt的问题。</p>
<p><a href="https://github.com/marketplace/actions/install-qt" target="_blank" rel="noopener">install-qt-action</a></p>
<p>github的Actions有一个非常强大的功能，就是引用外部模板。</p>
<p>比如要引入这个install-qt-Actions模板，只要在配置文件中添加两行即可：</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">...</span></span><br><span class="line"><span class="attr">    - name:</span> <span class="string">Install</span> <span class="string">Qt</span></span><br><span class="line"><span class="attr">      uses:</span> <span class="string">jurplel/install-qt-action@v2</span></span><br><span class="line"><span class="string">...</span></span><br></pre></td></tr></table></figure>

<p>Qt的安装路径、版本、目标平台、目标架构都有默认配置，当然你也可以手动配置</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">...</span></span><br><span class="line"><span class="attr">    - name:</span> <span class="string">Install</span> <span class="string">Qt</span></span><br><span class="line"><span class="attr">      uses:</span> <span class="string">jurplel/install-qt-action@v2</span></span><br><span class="line"><span class="attr">        with:</span></span><br><span class="line">          <span class="comment"># 安装目录,默认当前路径</span></span><br><span class="line">          <span class="comment">#dir: # optional</span></span><br><span class="line">          <span class="comment"># 版本,默认最新的LTS(5.12.6)</span></span><br><span class="line"><span class="attr">          version:</span> <span class="number">5.12</span><span class="number">.6</span></span><br><span class="line">          <span class="comment"># 编译平台。一般不修改。</span></span><br><span class="line">          <span class="comment">#host: # optional</span></span><br><span class="line">          <span class="comment"># 目标平台。默认desktop，可选android、ios</span></span><br><span class="line"><span class="attr">          target:</span> <span class="string">desktop</span></span><br><span class="line">          <span class="comment"># 架构</span></span><br><span class="line"><span class="attr">          arch:</span> <span class="string">win64_msvc2017_64</span></span><br><span class="line"><span class="string">...</span></span><br></pre></td></tr></table></figure>

<p>这个Actions模板的实现，是按照Actions的工作原理（TypeScript），调用另一个python仓库<a href="https://github.com/miurahr/aqtinstall" target="_blank" rel="noopener">aqtinstall</a>,</p>
<p>把配置参数传递过去，由该库完成Qt的安装。</p>
<p>aqtinstall由一位日本的程序员使用python开发，直接访问Qt官方的发布仓库</p>
<p><a href="http://download.qt.io/online/qtsdkrepository/" target="_blank" rel="noopener">http://download.qt.io/online/qtsdkrepository/</a> , 下载指定平台的各模块压缩包，并解压到指定目录。</p>
<p>直接绕过了我们平常使用的Qt安装器。</p>
<p>aqtinstall没有实现‘只安装指定模块’，默认全安装。希望后续能做支持，毕竟Qt全安装太大了。</p>
<h4 id="action-setup-qt"><a href="#action-setup-qt" class="headerlink" title="action-setup-qt"></a>action-setup-qt</h4><p>涛哥还发现一个开源的action，并没有进商店，功能是适配所有平台的Qt环境变量</p>
<p><a href="https://github.com/Skycoder42/action-setup-qt" target="_blank" rel="noopener">https://github.com/Skycoder42/action-setup-qt</a></p>
<p>可以在该作者的’Json序列化库’中，看到实际应用</p>
<p><a href="https://github.com/Skycoder42/QtJsonSerializer" target="_blank" rel="noopener">https://github.com/Skycoder42/QtJsonSerializer</a></p>
<p>目前是固定在Qt5.13.2版本，包含winrt、wasm等所有平台。</p>
<h2 id="扩展"><a href="#扩展" class="headerlink" title="扩展"></a>扩展</h2><p>接下来，说一下涛哥提供的模板，对各平台的配置。</p>
<p>以方便那些，需要对模板做修改的同学。</p>
<h3 id="Windows平台"><a href="#Windows平台" class="headerlink" title="Windows平台"></a>Windows平台</h3><p>涛哥在这个配置文件中，写了一些注释。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># windows.yml</span></span><br><span class="line"><span class="attr">name:</span> <span class="string">Windows</span></span><br><span class="line"><span class="attr">on:</span> </span><br><span class="line">  <span class="comment"># push代码时触发workflow</span></span><br><span class="line"><span class="attr">  push:</span></span><br><span class="line">    <span class="comment"># 忽略README.md</span></span><br><span class="line"><span class="attr">    paths-ignore:</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'README.md'</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'LICENSE'</span></span><br><span class="line">  <span class="comment"># pull_request时触发workflow</span></span><br><span class="line"><span class="attr">  pull_request:</span></span><br><span class="line">    <span class="comment"># 忽略README.md</span></span><br><span class="line"><span class="attr">    paths-ignore:</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'README.md'</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'LICENSE'</span></span><br><span class="line"><span class="attr">jobs:</span></span><br><span class="line"><span class="attr">  build:</span></span><br><span class="line"><span class="attr">    name:</span> <span class="string">Build</span></span><br><span class="line">    <span class="comment"># 运行平台， windows-latest目前是windows server 2019</span></span><br><span class="line"><span class="attr">    runs-on:</span> <span class="string">windows-latest</span></span><br><span class="line"><span class="attr">    strategy:</span></span><br><span class="line">      <span class="comment"># 矩阵配置</span></span><br><span class="line"><span class="attr">      matrix:</span></span><br><span class="line"><span class="attr">        qt_ver:</span> <span class="string">[5.9.8,5.12.6]</span></span><br><span class="line"><span class="attr">        qt_target:</span> <span class="string">[desktop]</span></span><br><span class="line">        <span class="comment"># mingw用不了</span></span><br><span class="line">        <span class="comment"># qt_arch: [win64_msvc2017_64, win32_msvc2017, win32_mingw53,win32_mingw73]</span></span><br><span class="line"><span class="attr">        qt_arch:</span> <span class="string">[win64_msvc2017_64,</span> <span class="string">win32_msvc2017]</span></span><br><span class="line">        <span class="comment"># 从矩阵中除外的配置</span></span><br><span class="line"><span class="attr">        exclude:</span> </span><br><span class="line">          <span class="comment"># 不存在5.9.8-win32_msvc2017的版本</span></span><br><span class="line"><span class="attr">          - qt_ver:</span> <span class="number">5.9</span><span class="number">.8</span></span><br><span class="line"><span class="attr">            qt_arch:</span> <span class="string">win32_msvc2017</span></span><br><span class="line">          <span class="comment"># mingw用不了</span></span><br><span class="line">          <span class="comment"># - qt_ver: 5.9.8</span></span><br><span class="line">          <span class="comment">#   qt_arch: win32_mingw73</span></span><br><span class="line">          <span class="comment"># - qt_ver: 5.12.6</span></span><br><span class="line">          <span class="comment">#   qt_arch: win32_mingw53</span></span><br><span class="line">        <span class="comment"># 额外设置msvc_arch</span></span><br><span class="line"><span class="attr">        include:</span></span><br><span class="line"><span class="attr">          - qt_arch:</span> <span class="string">win64_msvc2017_64</span></span><br><span class="line"><span class="attr">            msvc_arch:</span> <span class="string">x64</span></span><br><span class="line"><span class="attr">          - qt_arch:</span> <span class="string">win32_msvc2017</span></span><br><span class="line"><span class="attr">            msvc_arch:</span> <span class="string">x86</span></span><br><span class="line">    <span class="comment"># 步骤</span></span><br><span class="line"><span class="attr">    steps:</span></span><br><span class="line">      <span class="comment"># 安装Qt</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">Install</span> <span class="string">Qt</span></span><br><span class="line">        <span class="comment"># 使用外部action。这个action专门用来安装Qt</span></span><br><span class="line"><span class="attr">        uses:</span> <span class="string">jurplel/install-qt-action@v2.0.0</span></span><br><span class="line"><span class="attr">        with:</span></span><br><span class="line">          <span class="comment"># Version of Qt to install</span></span><br><span class="line"><span class="attr">          version:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.qt_ver</span> <span class="string">&#125;&#125;</span></span><br><span class="line">          <span class="comment"># Target platform for build</span></span><br><span class="line"><span class="attr">          target:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.qt_target</span> <span class="string">&#125;&#125;</span></span><br><span class="line">          <span class="comment"># Architecture for Windows/Android</span></span><br><span class="line"><span class="attr">          arch:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.qt_arch</span> <span class="string">&#125;&#125;</span></span><br><span class="line">      <span class="comment"># 拉取代码</span></span><br><span class="line"><span class="attr">      - uses:</span> <span class="string">actions/checkout@v1</span></span><br><span class="line"><span class="attr">        with:</span></span><br><span class="line"><span class="attr">          fetch-depth:</span> <span class="number">1</span></span><br><span class="line">      <span class="comment"># 编译msvc</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">build-msvc</span></span><br><span class="line"><span class="attr">        shell:</span> <span class="string">cmd</span></span><br><span class="line"><span class="attr">        env:</span></span><br><span class="line"><span class="attr">          vc_arch:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.msvc_arch</span> <span class="string">&#125;&#125;</span></span><br><span class="line"><span class="attr">        run:</span> <span class="string">|</span></span><br><span class="line"><span class="string">          call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %vc_arch%</span></span><br><span class="line"><span class="string">          qmake</span></span><br><span class="line"><span class="string">          nmake</span></span><br></pre></td></tr></table></figure>

<p>大部分配置都是显而易见的，这里对一些特殊情况做一些说明吧。</p>
<h4 id="默认mingw不能用"><a href="#默认mingw不能用" class="headerlink" title="默认mingw不能用"></a>默认mingw不能用</h4><p>windows平台优先推荐用msvc编译，不过有些情况不得不用mingw。</p>
<p>github-Actions提供的Windows Server 2019环境，预装Mingw为8.1.0，版本太高了。</p>
<p>Qt5.9需要的mingw版本是5.3，而5.12则需要7.3，涛哥试过简单的HelloWorld程序，都会报链接失败。</p>
<p>所以需要使用MinGW的同学，需要自己安装了。</p>
<h4 id="Windows平台指定shell"><a href="#Windows平台指定shell" class="headerlink" title="Windows平台指定shell"></a>Windows平台指定shell</h4><p>github-Actions在Windows平台默认的shell是PowerShell，其它平台是bash。</p>
<p>使用msvc命令行编译项目时，一般要先调用’vcvarsxxx.bat’脚本来设置环境变量。</p>
<p>Powershell虽然强大，却不太方便直接调用这个bat。要么安装Powershell扩展Pcsx，要么</p>
<p>用一些取巧的方式：</p>
<p><a href="https://stackoverflow.com/questions/2124753/how-can-i-use-powershell-with-the-visual-studio-command-prompt" target="_blank" rel="noopener">https://stackoverflow.com/questions/2124753/how-can-i-use-powershell-with-the-visual-studio-command-prompt</a></p>
<p>github-Actions当然也可以直接指定使用cmd。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="string">...</span></span><br><span class="line">      <span class="comment"># 编译msvc</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">build-msvc</span></span><br><span class="line"><span class="attr">        shell:</span> <span class="string">cmd</span></span><br><span class="line"><span class="attr">        env:</span></span><br><span class="line"><span class="attr">          vc_arch:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.msvc_arch</span> <span class="string">&#125;&#125;</span></span><br><span class="line"><span class="attr">        run:</span> <span class="string">|</span></span><br><span class="line"><span class="string">          call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %vc_arch%</span></span><br><span class="line"><span class="string">          qmake</span></span><br><span class="line"><span class="string">          nmake</span></span><br><span class="line"><span class="string">...</span></span><br></pre></td></tr></table></figure>

<h3 id="Ubuntu平台"><a href="#Ubuntu平台" class="headerlink" title="Ubuntu平台"></a>Ubuntu平台</h3><p>Ubuntu 平台看配置吧。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># ubuntu.yml</span></span><br><span class="line"><span class="attr">name:</span> <span class="string">Ubuntu</span></span><br><span class="line"><span class="comment"># Qt官方没有linux平台的x86包</span></span><br><span class="line"><span class="attr">on:</span> </span><br><span class="line"><span class="attr">  push:</span></span><br><span class="line"><span class="attr">    paths-ignore:</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'README.md'</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'LICENSE'</span></span><br><span class="line"><span class="attr">  pull_request:</span></span><br><span class="line"><span class="attr">    paths-ignore:</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'README.md'</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'LICENSE'</span></span><br><span class="line"><span class="attr">jobs:</span></span><br><span class="line"><span class="attr">  build:</span></span><br><span class="line"><span class="attr">    name:</span> <span class="string">Build</span></span><br><span class="line"><span class="attr">    runs-on:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.os</span> <span class="string">&#125;&#125;</span></span><br><span class="line"><span class="attr">    strategy:</span></span><br><span class="line"><span class="attr">      matrix:</span></span><br><span class="line"><span class="attr">        os:</span> <span class="string">[ubuntu-16.04,ubuntu-18.04]</span></span><br><span class="line"><span class="attr">        qt_ver:</span> <span class="string">[5.9.8,5.12.6]</span></span><br><span class="line"><span class="attr">    steps:</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">Install</span> <span class="string">Qt</span></span><br><span class="line"><span class="attr">        uses:</span> <span class="string">jurplel/install-qt-action@v2.0.0</span></span><br><span class="line"><span class="attr">        with:</span></span><br><span class="line"><span class="attr">          version:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.qt_ver</span> <span class="string">&#125;&#125;</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">ubuntu</span> <span class="string">install</span> <span class="string">GL</span> <span class="string">library</span></span><br><span class="line"><span class="attr">        run:</span> <span class="string">sudo</span> <span class="string">apt-get</span> <span class="string">install</span> <span class="bullet">-y</span> <span class="string">libglew-dev</span> <span class="string">libglfw3-dev</span></span><br><span class="line"><span class="attr">      - uses:</span> <span class="string">actions/checkout@v1</span></span><br><span class="line"><span class="attr">        with:</span></span><br><span class="line"><span class="attr">          fetch-depth:</span> <span class="number">1</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">build</span> <span class="string">ubuntu</span></span><br><span class="line"><span class="attr">        run:</span> <span class="string">|</span></span><br><span class="line"><span class="string">          qmake</span></span><br><span class="line"><span class="string">          make</span></span><br></pre></td></tr></table></figure>
<h3 id="MacOS平台"><a href="#MacOS平台" class="headerlink" title="MacOS平台"></a>MacOS平台</h3><p>MacOS平台和Ubuntu差别不大</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># macos.yml</span></span><br><span class="line"><span class="attr">name:</span> <span class="string">MacOS</span></span><br><span class="line"><span class="attr">on:</span> </span><br><span class="line"><span class="attr">  push:</span></span><br><span class="line"><span class="attr">    paths-ignore:</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'README.md'</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'LICENSE'</span></span><br><span class="line"><span class="attr">  pull_request:</span></span><br><span class="line"><span class="attr">    paths-ignore:</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'README.md'</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'LICENSE'</span></span><br><span class="line"><span class="attr">jobs:</span></span><br><span class="line"><span class="attr">  build:</span></span><br><span class="line"><span class="attr">    name:</span> <span class="string">Build</span></span><br><span class="line"><span class="attr">    runs-on:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.os</span> <span class="string">&#125;&#125;</span></span><br><span class="line"><span class="attr">    strategy:</span></span><br><span class="line"><span class="attr">      matrix:</span></span><br><span class="line"><span class="attr">        os:</span> <span class="string">[macos-latest]</span></span><br><span class="line"><span class="attr">        qt_ver:</span> <span class="string">[5.9.8,5.12.6]</span></span><br><span class="line"><span class="attr">    steps:</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">Install</span> <span class="string">Qt</span></span><br><span class="line"><span class="attr">        uses:</span> <span class="string">jurplel/install-qt-action@v2.0.0</span></span><br><span class="line"><span class="attr">        with:</span></span><br><span class="line"><span class="attr">          version:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.qt_ver</span> <span class="string">&#125;&#125;</span></span><br><span class="line"><span class="attr">      - uses:</span> <span class="string">actions/checkout@v1</span></span><br><span class="line"><span class="attr">        with:</span></span><br><span class="line"><span class="attr">          fetch-depth:</span> <span class="number">1</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">build</span> <span class="string">macos</span></span><br><span class="line"><span class="attr">        run:</span> <span class="string">|</span></span><br><span class="line"><span class="string">          qmake</span></span><br><span class="line"><span class="string">          make</span></span><br></pre></td></tr></table></figure>
<h3 id="Android平台"><a href="#Android平台" class="headerlink" title="Android平台"></a>Android平台</h3><p>Android使用ubuntu编译，Windows那个ndk似乎没装，未尝试。</p>
<p>如果只使用Qt5.12.6，默认的配置可以直接用，编译前设置环境变量 ANDROID_SDK_ROOT</p>
<p>和ANDROID_NDK_ROOT就可以了。</p>
<p>Qt5.9.8要指定低版本的NDK、SDK才行，这里涛哥没有进一步尝试。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># android.yml</span></span><br><span class="line"><span class="attr">name:</span> <span class="string">Android</span></span><br><span class="line"><span class="attr">on:</span> </span><br><span class="line"><span class="attr">  push:</span></span><br><span class="line"><span class="attr">    paths-ignore:</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'README.md'</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'LICENSE'</span>      </span><br><span class="line"><span class="attr">  pull_request:</span></span><br><span class="line"><span class="attr">    paths-ignore:</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'README.md'</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'LICENSE'</span>      </span><br><span class="line"><span class="attr">jobs:</span></span><br><span class="line"><span class="attr">  build:</span></span><br><span class="line"><span class="attr">    name:</span> <span class="string">Build</span></span><br><span class="line"><span class="attr">    runs-on:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.os</span> <span class="string">&#125;&#125;</span></span><br><span class="line"><span class="attr">    strategy:</span></span><br><span class="line"><span class="attr">      matrix:</span></span><br><span class="line"><span class="attr">        os:</span> <span class="string">[ubuntu-latest]</span></span><br><span class="line">        <span class="comment"># 5.9.8 版本低，需要额外设置工具链。这里暂不支持。</span></span><br><span class="line"><span class="attr">        qt_ver:</span> <span class="string">[5.12.6]</span></span><br><span class="line"><span class="attr">        qt_target:</span> <span class="string">[android]</span></span><br><span class="line">        <span class="comment"># android_arm64_v8a 暂时不支持. install-qt-action 依赖的aqtinstall版本为0.5*,需要升级</span></span><br><span class="line">        <span class="comment"># qt_arch: [android_x86,android_armv7,android_arm64_v8a]</span></span><br><span class="line"><span class="attr">        qt_arch:</span> <span class="string">[android_x86,android_armv7]</span></span><br><span class="line">        <span class="comment"># exclude:</span></span><br><span class="line">        <span class="comment">#   - qt_ver: 5.9.8</span></span><br><span class="line">        <span class="comment">#     qt_arch: android_arm64_v8a</span></span><br><span class="line"><span class="attr">    steps:</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">Install</span> <span class="string">Qt</span></span><br><span class="line">        <span class="comment"># if: steps.cacheqt.outputs.cache-hit != 'true'</span></span><br><span class="line"><span class="attr">        uses:</span> <span class="string">jurplel/install-qt-action@v2.0.0</span></span><br><span class="line"><span class="attr">        with:</span></span><br><span class="line">          <span class="comment"># Version of Qt to install</span></span><br><span class="line"><span class="attr">          version:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.qt_ver</span> <span class="string">&#125;&#125;</span></span><br><span class="line">          <span class="comment"># Target platform for build</span></span><br><span class="line"><span class="attr">          target:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.qt_target</span> <span class="string">&#125;&#125;</span></span><br><span class="line">          <span class="comment"># Architecture for Windows/Android</span></span><br><span class="line"><span class="attr">          arch:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.qt_arch</span> <span class="string">&#125;&#125;</span></span><br><span class="line"><span class="attr">      - uses:</span> <span class="string">actions/checkout@v1</span></span><br><span class="line"><span class="attr">        with:</span></span><br><span class="line"><span class="attr">          fetch-depth:</span> <span class="number">1</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">build</span> <span class="string">android</span></span><br><span class="line"><span class="attr">        run:</span> <span class="string">|</span></span><br><span class="line"><span class="string">          export ANDROID_SDK_ROOT=$ANDROID_HOME</span></span><br><span class="line"><span class="string">          export ANDROID_NDK_ROOT=$ANDROID_HOME/ndk-bundle</span></span><br><span class="line"><span class="string">          qmake</span></span><br><span class="line"><span class="string">          make</span></span><br></pre></td></tr></table></figure>

<h3 id="IOS平台"><a href="#IOS平台" class="headerlink" title="IOS平台"></a>IOS平台</h3><p>ios只能使用MacOS编译。</p>
<p>qmake的时候要指定平台、release模式等。</p>
<figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#ios.yml</span></span><br><span class="line"><span class="attr">name:</span> <span class="string">IOS</span></span><br><span class="line"><span class="attr">on:</span> </span><br><span class="line"><span class="attr">  push:</span></span><br><span class="line"><span class="attr">    paths-ignore:</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'README.md'</span></span><br><span class="line"><span class="attr">  pull_request:</span></span><br><span class="line"><span class="attr">    paths-ignore:</span></span><br><span class="line"><span class="bullet">      -</span> <span class="string">'README.md'</span></span><br><span class="line"><span class="attr">jobs:</span></span><br><span class="line"><span class="attr">  build:</span></span><br><span class="line"><span class="attr">    name:</span> <span class="string">Build</span></span><br><span class="line"><span class="attr">    runs-on:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.os</span> <span class="string">&#125;&#125;</span></span><br><span class="line"><span class="attr">    strategy:</span></span><br><span class="line"><span class="attr">      matrix:</span></span><br><span class="line"><span class="attr">        os:</span> <span class="string">[macos-latest]</span></span><br><span class="line"><span class="attr">        qt_ver:</span> <span class="string">[5.12.6]</span></span><br><span class="line"><span class="attr">        qt_target:</span> <span class="string">[ios]</span></span><br><span class="line"><span class="attr">    steps:</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">Install</span> <span class="string">Qt</span></span><br><span class="line">        <span class="comment"># if: steps.cacheqt.outputs.cache-hit != 'true'</span></span><br><span class="line"><span class="attr">        uses:</span> <span class="string">jurplel/install-qt-action@v2.0.0</span></span><br><span class="line"><span class="attr">        with:</span></span><br><span class="line">          <span class="comment"># Version of Qt to install</span></span><br><span class="line"><span class="attr">          version:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.qt_ver</span> <span class="string">&#125;&#125;</span></span><br><span class="line">          <span class="comment"># Target platform for build</span></span><br><span class="line"><span class="attr">          target:</span> <span class="string">$&#123;&#123;</span> <span class="string">matrix.qt_target</span> <span class="string">&#125;&#125;</span></span><br><span class="line"><span class="attr">      - uses:</span> <span class="string">actions/checkout@v1</span></span><br><span class="line"><span class="attr">        with:</span></span><br><span class="line"><span class="attr">          fetch-depth:</span> <span class="number">1</span></span><br><span class="line"><span class="attr">      - name:</span> <span class="string">build</span> <span class="string">ios</span></span><br><span class="line"><span class="attr">        run:</span> <span class="string">|</span></span><br><span class="line"><span class="string">          qmake -r -spec macx-ios-clang CONFIG+=release CONFIG+=iphoneos</span></span><br><span class="line"><span class="string">          make</span></span><br></pre></td></tr></table></figure>
    </div>
    
    <div class="reward" ontouchstart>
    <div class="reward-wrap">赏
        <div class="reward-box">
            
            <span class="reward-type">
                <img class="alipay" src="/img/zhifubao.jpg"><b>支付宝打赏</b>
            </span>
            
            
            <span class="reward-type">
                <img class="wechat" src="/img/weixin.jpg"><b>微信打赏</b>
            </span>
            
        </div>
    </div>
    <p class="reward-tip">
        为众人抱薪者,不可使其冻毙于霜雪
    </p>
</div>
    
    <div class="post-footer">
        <div>
            
            转载声明：
            文章采用<a href="http://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a>进行许可, 转载请注明出处 © <a href="https://jaredtao.github.io" target="_blank">武威的涛哥</a>
            
            
        </div>
        <div>
            
        </div>
    </div>
</article>
<div class="article-nav prev-next-wrap clearfix">
    
    <a href="/2019/12/03/%E7%8E%A9%E8%BD%ACQt(11)-github-Actions%E8%87%AA%E5%8A%A8%E5%8C%96%E5%8F%91%E8%A1%8C/" class="pre-post btn btn-default" title='玩转Qt(11)-github-Actions自动化发行'>
        <i class="fa fa-angle-left fa-fw"></i><span class="hidden-lg">上一篇</span>
        <span class="hidden-xs">
            玩转Qt(11)-github-Actions自动化发行</span>
    </a>
    
    
    <a href="/2019/09/12/%E7%8E%A9%E8%BD%ACQt(9)-%E7%A8%8B%E5%BA%8F%E5%8F%91%E5%B8%83%E6%8C%87%E5%8D%97/" class="next-post btn btn-default" title='玩转Qt(9)-程序发布指南'>
        <span class="hidden-lg">下一篇</span>
        <span class="hidden-xs">
            玩转Qt(9)-程序发布指南</span><i class="fa fa-angle-right fa-fw"></i>
    </a>
    
</div>

<div id="comments">
    

<div id="vcomments" class="valine"></div>

<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="/assets/valine.min.js"></script>

<script>
new Valine({
    av: AV,
    el: '#vcomments',
    appId: 'qegD4552u6FU9HoNDvRsonko-gzGzoHsz',
    appKey: 'eitB2FV5n2qyMHcDM7x6EQpt',
    placeholder: '说点什么吧',
    notify: false,
    verify: true,
    avatar: 'mm',
    meta: 'nick,mail'.split(','),
    pageSize: '10',
    path: window.location.pathname,
    lang: 'zh-CN'.toLowerCase()
})
</script>


</div>


                </main>
                
                    <aside id="article-toc" role="navigation" class="col-md-4">
    <div class="widget">
        <h3 class="title">
            文章目录
        </h3>
        
        <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#前言"><span class="toc-text">前言</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#简介"><span class="toc-text">简介</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#代码仓库"><span class="toc-text">代码仓库</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#效果预览"><span class="toc-text">效果预览</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#使用方式"><span class="toc-text">使用方式</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#原理"><span class="toc-text">原理</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Actions官方文档"><span class="toc-text">Actions官方文档</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Actions的默认环境"><span class="toc-text">Actions的默认环境</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Actions语法"><span class="toc-text">Actions语法</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Actions模板"><span class="toc-text">Actions模板</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Qt项目的编译流程"><span class="toc-text">Qt项目的编译流程</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Qt相关的Actions模板"><span class="toc-text">Qt相关的Actions模板</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#install-qt-action"><span class="toc-text">install-qt-action</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#action-setup-qt"><span class="toc-text">action-setup-qt</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#扩展"><span class="toc-text">扩展</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Windows平台"><span class="toc-text">Windows平台</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#默认mingw不能用"><span class="toc-text">默认mingw不能用</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Windows平台指定shell"><span class="toc-text">Windows平台指定shell</span></a></li></ol></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Ubuntu平台"><span class="toc-text">Ubuntu平台</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#MacOS平台"><span class="toc-text">MacOS平台</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Android平台"><span class="toc-text">Android平台</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#IOS平台"><span class="toc-text">IOS平台</span></a></li></ol></li></ol>
        
    </div>
</aside>
                
            </div>
        </div>
    </section>
    <footer class="main-footer">
    <div class="container">
        <div class="row">
        </div>
    </div>
</footer>
<a id="back-to-top" class="icon-btn hide">
    <i class="fa fa-chevron-up"></i>
</a>
    <div class="copyright">
    <div class="container">
        <div class="row">
            <div class="col-sm-12">
                <div class="busuanzi">
    
    访问量:
    <strong id="busuanzi_value_site_pv">
        <i class="fa fa-spinner fa-spin"></i>
    </strong>
    &nbsp; | &nbsp;
    访客数:
    <strong id="busuanzi_value_site_uv">
        <i class="fa fa-spinner fa-spin"></i>
    </strong>
    
</div>
            </div>
            <div class="col-sm-12">
                <span>Copyright &copy;
                    2019
                    
                </span> |
                <span>
                    Powered by <a href="//hexo.io" class="copyright-links" target="_blank" rel="nofollow">Hexo</a>
                </span> |
                <span>
                    Theme by <a href="//github.com/shenliyang/hexo-theme-snippet.git" class="copyright-links" target="_blank" rel="nofollow">Snippet</a>
                </span>
            </div>
        </div>
    </div>
</div>



<script src="/assets/tagcanvas.min.js?rev=2.9.js"></script>

<script>
var tagOption = {
    textColour: '#444', // 字体颜色
    outlineMethod: 'block', // 选中模式
    outlineColour: '#FFDAB9', // 选中模式的颜色
    interval: 30 || 30, // 动画帧之间的时间间隔，值越大，转动幅度越大
    textHeight: 13,
    outlineRadius: 3,
    freezeActive: true || '', // 选中的标签是否继续滚动
    frontSelect: true || '', // 不选标签云后部的标签
    initial: [0.1, -0.1],
    depth: 0.5,
    decel: 0.95,
    maxSpeed: 0.03,
    reverse: true || '', // 是否反向触发
    fadeIn: 500, // 进入动画时间
    wheelZoom: false || '' // 是否启用鼠标滚轮
}
TagCanvas.Start('tag-cloud-3d', '', tagOption);
</script>


<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>


<script src="/js/app.js?rev=@@hash.js"></script>

</body>
</html>